package com.emuporium.gymrat.server.data;

import java.util.LinkedHashMap;
import java.util.Map;

import org.simpleframework.xml.ElementMap;
import org.simpleframework.xml.Root;

/** Generic object to return to client during AJAX requests.
 * Tagged for SimpleXML parsing.
 * 
 * @author Dan
 *
 */
@Root
public class AjaxResponse{
	 
	 @ElementMap(entry="entry", key="id", attribute=false, inline=true)
	 LinkedHashMap<Integer,String> variations;
	 
	 public AjaxResponse(){
		 variations = new LinkedHashMap<Integer,String>();
	 }
	 
	 public void add(Integer id, String variation){
		 variations.put(id, variation);
	 }
	 
	 public void addMap(Map<Integer,String> map){
		 variations.putAll(map);
	 }

	public LinkedHashMap<Integer, String> getVariations() {
		return variations;
	}

	public void setVariations(LinkedHashMap<Integer, String> variations) {
		this.variations = variations;
	}
}
